//
//  ViewController.m
//  UIBezierPath
//
//  Created by J on 16/2/24.
//  Copyright © 2016年 J. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    //创建椭圆形贝塞尔曲线
    UIBezierPath* path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, 200, 100)];
    
    //创建矩形贝塞尔曲线
//    UIBezierPath* path = [UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 100, 100)];
    //创建圆形贝塞尔曲线
//        UIBezierPath* path = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, 100, 100)];


    
    //创建CAShapeLayer
    CAShapeLayer* shape = [CAShapeLayer layer];
    shape.borderWidth = 2.0f;
    shape.frame = CGRectMake(0, 0, 200, 100);//UIBezierPath
    shape.masksToBounds = YES;
    shape.position = self.view.center;
    shape.path = path.CGPath;
    shape.backgroundColor = [UIColor orangeColor].CGColor;
    shape.fillColor = [UIColor purpleColor].CGColor;//修改贝塞尔曲线的填充颜色
    [self.view.layer addSublayer:shape];

    
    

}


@end
